#ifndef INC_COMMAND_H
#define INC_COMMAND_H

/**
 * Interface class forms the base of all Commands in the controller.
 *
 * Subclasses should:
 * 1) be named FooCmd.
 * 2) have a reasonably fast copy constructor.
 * 3) perform absolute, not relative, operations--e.g., a MoveCmd should set an
 *   explicit position, not calculate one based on a delta from an object's
 *   previous position. (This is for undo.)
 * 4) Support calling execute() multiple times (see execute()).
 */
class Command
{
	public:
		/*** COMMANDISH STUFF ***/

		/**
		 * Executes the command. This may be called multiple times in a row
		 * without an intervening unexecute(). Re-calls should "update" the
		 * action performed with any new data.
		 *
		 * For example, each call to execute() on a MoveCmd should move the
		 * specified object with the stored coordinates.
		 */
		virtual void execute() = 0;

		/**
		 * Reverses execution of the command, e.g., for undo. Multiple calls to
		 * execute() should only require one call to unexecute().
		 *
		 * Calling unexecute() on an non-executed command should do nothing.
		 */
		virtual void unexecute() = 0;

		/**
		 * @return true if executing the command in its current state would
		 * produce any state transition from the unexecuted command; false if
		 * it definitely would not.
		 */
		virtual bool useful() const;

		/**
		 * Just for debugging.
		 */
		virtual const char* name() const = 0;
};

#endif //INCLUDE_COMMAND_H

